<template>
	<view>
		<m-block class="notice2 flex" gap="12 24" radius="12">
			<m-icon type="notice" :size="[42, 42]" color="var(--text_thenme)" />
			<!-- <m-icon type="icon-yangshengqi" size="24" color="var(--text_thenme)"></m-icon> -->
			<view class="center otw ml-24 flex-1 fs26" @click="openFn()">
				{{ noticeObj.title ? noticeObj.title : '暂无内容' }}
			</view>
			<m-icon type="icon-_fenlei" size="36" @click="Jump('/pages/news/newsList/newsList?&title=' + '平台公告' + `&typeid=${typeid}`)"></m-icon>
		</m-block>
		<m-tips ref="tips" :title="noticeObj.title" :content="noticeObj.content"></m-tips>
	</view>
</template>
<script>
import { GetNewsPage } from '@/api/News.js';
import { mapState } from 'vuex';
export default {
	name: 'm-notice',
	data() {
		return {
			code: '',
			typeid: 1,
			noticeObj: {},
			noticeShow: false
		};
	},
	computed: {
		...mapState({
			userinfo: (state) => state.user.userinfo
		})
	},
	onShow() {},
	methods: {
		openFn() {
			if (!this.noticeObj.title) return;
			this.$refs.tips.openUp();
		},
		async getNotice() {
			const { success, totalCount, msg, list, pageCount } = await GetNewsPage({
				typeid: this.typeid,
				code: this.code,
				pageIndex: 1,
				pageSize: 1
			});
			if (list.length == 0) {
				return;
			}
			this.noticeObj = list[0];
			if (this.openNotice(this.noticeObj.id)) {
				this.$refs.tips.openUp();
			}
		}
	}
};
</script>

<style lang="scss">
.notice1 {
	box-shadow: 0rpx 0rpx 6rpx 1rpx rgba(0, 0, 0, 0.1);

	.center {
		flex: 1;
		text-align: left;
		padding-left: 20rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #333;
	}
}

.notice2 {
	background-color: #fff;
}

::v-deep.uni-popup .uni-popup__wrapper {
	width: 90% !important;
	padding: 40rpx;
}
</style>
